#!/bin/bash

gcc -o sum_gen sum_gen.c
#gcc -o sum_gen1 sum_gen1.c
#gcc -o sumi sumi.c
gcc -o sum sum.c
gcc -o sum2bc sum2bc.c

./sum_gen > sum.in
./sum2bc < sum.in > bc.in
./sum < sum.in > sum.out
bc < bc.in | sed 's/\\//' | sed 's/\n//' > bc.out

exit

./sum_gen > sum.in
./sumi < sum.in > sumi.out
./sum < sum.in > sum.out

exit

#./sum_gen > sum.in
#./sum_gen1 > sum.in
#cat sum.in
#echo '-----------------'
z=100000
n=100
for i in {1..1000};
do
	echo $n > sum.in;
	for j in {1..100};
	do
		echo $((($RANDOM%z)-($RANDOM%z))) >> sum.in;
	done;
	s1=`./sumi < sum.in`
	s2=`./sum < sum.in`
	if [ $s1 -ne $s2 ]; then
		echo "OK!"
	fi
done;


